dec = []
for i in range(1, 10001):
    if i < 10:
        dec.append(i)
    dec.append(int(str(i) + str(i)[::-1]))
dec.sort()
k = 2
ks = []


def mirrorNum(num, k):
    # 翻译为k进制字符串再翻折
    # 用栈处理会先得到 前半部分也保证了没有前导0
    stack = []
    while num:
        stack.append(str(num % k))
        num //= k
    return ''.join(stack) + ''.join(stack[::-1])


for i in range(1, 10001):
    if i < k:
        ks.append(i)
    ks.append(mirrorNum(i, k))

print()
